﻿using System;

namespace TimeTracker.Models
{
    public partial class EntryModel
    {
        public string Id { get; set; }
        public string UserId { get; set; }
        public string ProjectId { get; set; }
        public string ClientId { get; set; }

        public string Client { get; set; }
        public string Project { get; set; }
        public string Description { get; set; }

        public DateTime LastStartTime { get; set; }
        public TimeSpan ElapsedTime { get; set; }
        public TimeSpan TotalElapsed
        {
            get
            {
                if (IsActive)
                    return ElapsedTime.Add(DateTime.Now.Subtract(LastStartTime));
                else
                    return ElapsedTime;
            }
        }

        public bool IsActive { get; set; }

        public EntryModel()
        {
            this.LastStartTime = DateTime.Now;
        }
    }
}
